
import 'package:flutter/widgets.dart';
import 'package:flutter_frame/page/main/mine_page.dart';
import 'package:flutter_frame/page/main/order_page.dart';

import '../page/login/login_page.dart';
import '../page/login/region_page.dart';
import '../page/main/home_page.dart';
import '../weiget/tab/my_tabbar.dart';

class Routers {
  ///tabBar视图
  static String tabBar = "/tabBar";

  ///登陆模块
  static String login = "/login";
  static String region = "/region";

  ///首页模块
  static String home = "/home";
  static String scan = "/scan";

  ///订单模块
  static String orderList = "/orderList";
  static String orderDetail = "/orderDetail";

  ///我的模块
  static String mine = "/mine";
  static String mineInfo = "/mineInfo";
  static String coupon = "/coupon";
  static String language = "/language";
  static String feedback = "/feedback";
  static String guide = "/guide";
  static String face = "/face";
  static String setting = "/setting";
  static String paymentList = "/paymentList";


  static var routerMap = {
    tabBar: (context) => MyTabbar(),
    //
    // 登陆
    login: (context) => LoginPage(),
    region: (context) => RegionPage(),
    //
    // 首页
    home: (context) => HomePage(),
    // 订单
    orderList: (context) => OrderPage(),
    // 我的
    mine: (context) => MinePage(),


  };
}

Widget? getWidgetByRouterName(BuildContext context, String routerName) {
  Function? pageContentBuilder = Routers.routerMap[routerName];
  if (pageContentBuilder != null) {
    return pageContentBuilder(context);
  }
  return null;
}
